<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="utf-8">
    <title>学生管理</title>
    <link type="text/css" href="${pageContext.request.contextPath}/static/bootstrap-3.4.1-dist/css/bootstrap.min.css" rel="stylesheet"/>

</head>
<body>
    学生管理
    <p>
        <a href="/student?t=add">新增</a>
    </p>
    <table class="table table-hover">
        <thead>
        <tr>
            <th>编号</th>
            <th>学生姓名</th>
            <th>学生性别</th>
            <th>生日</th>
            <th>教师</th>
            <th>班级</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${pages.list}" var="student" varStatus="state">
            <tr>
                <th scope="row">${state.count}</th>
                <td>${student.name}</td>
                <td>${student.gender == 1? '男': '女'}</td>
                <td>${student.birthday}</td>
                <td>${student.teacherName}</td>
                <td>${student.className}</td>
                <td>
                    <a href="/student?t=edit&id=${student.id}">修改</a>
                    <a href="/student?t=delete&id=${student.id}">删除</a>

<%--                    <a href="/studelete?id=${student.id}">删除</a>--%>
                </td>
            </tr>
        </c:forEach>
        </tbody>
        <tfoot>
        <tr style="text-align: center">
                <td colspan="7">
                    <c:if test="${!pages.hasPre}">
                        <span>上一页</span>
                    </c:if>
                    <c:if test="${pages.hasPre}">
                        <a href="/student?page=${pages.current - 1}&size=${pages.pageSize}">上一页</a>
                    </c:if>
                    <c:forEach items="${pages.nums}" var="num">
                        <c:if test="${pages.current == num}">
                            <span>${num}</span>
                        </c:if>
                        <c:if test="${pages.current != num}">
                            <a href="/student?page=${num}&size=${pages.pageSize}">${num}</a>
                        </c:if>
                    </c:forEach>

                    <c:if test="${!pages.hasNext}">
                        <span>下一页</span>
                    </c:if>
                    <c:if test="${pages.hasNext}">
                        <a href="/student?page=${pages.current + 1}&size=${pages.pageSize}">下一页</a>
                    </c:if>
                </td>
            </tr>
        </tfoot>
    </table>
</body>
</html>
